import { createRouter, createWebHashHistory } from 'vue-router'

const layout = () => import('@/views/layout')
const home = () => import('@/views/home')
const GoodDetail = () => import('@/views/good')
const login = () => import('@/views/login')
const cart = () => import('@/views/cart')
const order = () => import('@/views/Member/order')
const Pay = () => import('@/views/Member/pay')
const PayResult = () => import('@/views/Member/pay/result')
const routes = [
  {
    path: '',
    component: layout,
    children: [
      { path: '', component: home },
      { path: 'detail/:id', component: GoodDetail },
      { path: 'cart', component: cart },
      { path: 'order', component: order },
      { path: 'pay', component: Pay },
      { path: '/pay/callback', component: PayResult }
    ]
  },

  { path: '/login', component: login }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
